# sudo -E apt-get install python3.7-dev
#pip install mxnet autogluon

from autogluon import TabularPrediction as task
train_data = task.Dataset(file_path='https://autogluon.s3.amazonaws.com/datasets/Inc/train.csv')
test_data = task.Dataset(file_path='https://autogluon.s3.amazonaws.com/datasets/Inc/test.csv')
predictor = task.fit(train_data=train_data, label='class')
performance = predictor.evaluate(test_data)
plabels = predictor.predict(test_data)

'''
Loaded data from: https://autogluon.s3.amazonaws.com/datasets/Inc/train.csv | Columns = 15 / 15 | Rows = 39073 -> 39073
Loaded data from: https://autogluon.s3.amazonaws.com/datasets/Inc/test.csv | Columns = 15 / 15 | Rows = 9769 -> 9769
No output_directory specified. Models will be saved in: AutogluonModels/ag-20200113_071244/
Beginning AutoGluon training ...
Preprocessing data ...
Here are the first 10 unique label values in your data:  [' <=50K' ' >50K']
AutoGluon infers your prediction problem is: binary  (because only two unique label-values observed)
If this is wrong, please specify `problem_type` argument in fit() instead (You may specify problem_type as one of: ['binary', 'multiclass', 'regression'])


Selected class <--> label mapping:  class 1 =  >50K, class 0 =  <=50K
	Data preprocessing and feature engineering runtime = 0.19s ...
AutoGluon will gauge predictive performance using evaluation metric: accuracy
To change this, specify the eval_metric argument of fit()
/home/carl-hui/.virtualenvs/AI/lib/python3.7/imp.py:342: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
  return _load(spec)
Fitting model: RandomForestClassifierGini ...
	4.83s	 = Training runtime
	0.8504	 = Validation accuracy score
Fitting model: RandomForestClassifierEntr ...
	7.53s	 = Training runtime
	0.8504	 = Validation accuracy score
Fitting model: ExtraTreesClassifierGini ...
	5.73s	 = Training runtime
	0.8416	 = Validation accuracy score
Fitting model: ExtraTreesClassifierEntr ...
	5.74s	 = Training runtime
	0.842	 = Validation accuracy score
Fitting model: KNeighborsClassifierUnif ...
	0.25s	 = Training runtime
	0.7736	 = Validation accuracy score
Fitting model: KNeighborsClassifierDist ...
	0.28s	 = Training runtime
	0.7644	 = Validation accuracy score
Fitting model: LightGBMClassifier ...
	3.71s	 = Training runtime
	0.8672	 = Validation accuracy score
Fitting model: CatboostClassifier ...
	27.25s	 = Training runtime
	0.874	 = Validation accuracy score
Fitting model: NeuralNetClassifier ...
	338.93s	 = Training runtime
	0.8548	 = Validation accuracy score
Fitting model: LightGBMClassifierCustom ...
	4.83s	 = Training runtime
	0.8676	 = Validation accuracy score
Fitting model: weighted_ensemble_l1 ...
	1.08s	 = Training runtime
	0.8756	 = Validation accuracy score
AutoGluon training complete, total runtime = 406.52s ...
'''
